<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
<title>To insert the JavaScript code</title>
<style>@import url(coUA.css);</style>
<link disabled rel="stylesheet" href="htmlhelp.css">
</HEAD>

<BODY>
<h1>To insert the JavaScript code</h1>

<p>Insert the following JavaScript functions between the <code>&lt;HEAD&gt;</code> start and end tags of the page:</p>

<code>
&lt;SCRIPT LANGUAGE="JavaScript"&gt;<br>
&lt;!--<br>
function <i>function1Name</i>(<i>idVariable</i>){<br>
	//display the section if it's not displayed; hide it if it is displayed<br>
	if (<i>idVariable</i>.style.display=="none"){<i>idVariable</i>.style.display=""}<br>
	else{<i>idVariable</i>.style.display="none"}<br>
}<br>
function <i>function2Name</i>(<i>idVariable</i>){<br>
	//remove the section when user clicks in the opened DIV<br>
	if (<i>idVariable</i>.style.display==""){<i>idVariable</i>.style.display="none"}<br>
}<br>
--&gt;
</code>

<p>Where <code>function1Name</code> and <code>function2Name</code> are the names of each function, and <code>idVariable</code> is the variable for the unique ID that is passed to the script each time a user clicks the link.</p>

<h3>Example</h3>

<p>The following is the actual JavaScript code used in the HTML Help documentation:</p>

<code>
function doSection (secNum){<br>
	//display the section if it's not displayed; hide it if it is displayed<br>
	if (secNum.style.display=="none"){secNum.style.display=""}<br>
	else{secNum.style.display="none"}<br>
}<br>
<br>
function noSection (secNum){<br>
	//remove the section when user clicks in the opened DIV<br>
	if (secNum.style.display==""){secNum.style.display="none"}<br>
}<br>
</code>

<h3>Notes</h3>
<ul>
<li>You can use a <a href="ocx_scripts_globaljs.htm">global script file</a> to store all of your scripts in one location. This can make it much easier to maintain scripts that are used on multiple topics in a help system.
</li>
</ul>

<br>
<table border="0" cellpadding="0" cellspacing="4">
<tr> 
<td valign="top"><a href="ocx_dhtml_sb3.htm"><img src="step3.gif" alt="next step" border="0"></a>
</td><td><a href="ocx_dhtml_sb3.htm">Update your style sheet</A>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>


</BODY>
</HTML>
